package com.sikaryofficial.backend.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sikaryofficial.backend.domain.entity.ArticleExposureCount;
import com.sikaryofficial.backend.mapper.ArticleExposureCountMapper;
import com.sikaryofficial.backend.service.IArticleExposureCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * 文章曝光次数统计Service业务层处理
 * 
 * @author qinjinyuan
 * @date 2024-04-24
 */
@Service
public class ArticleExposureCountServiceImpl extends ServiceImpl<ArticleExposureCountMapper, ArticleExposureCount>  implements IArticleExposureCountService
{
    @Autowired
    private ArticleExposureCountMapper articleExposureCountMapper;

    @Override
    public List<ArticleExposureCount> countByArticleId(List<Long> articleIds) {
        if(CollUtil.isEmpty(articleIds)){
            return Collections.emptyList();
        }
        return articleExposureCountMapper.countByArticleId(articleIds);
    }
}
